//
//  DKHomeAuthorizedCircleView.m
//  DanKU
//
//  Created by 吴斌 on 2023/10/6.
//

#import "DKHomeAuthorizedCircleView.h"
#import "DKHomeCircleView.h"
#import "DKHomeSourceView.h"
@interface DKHomeAuthorizedCircleView()
@property (nonatomic, strong)DKHomeCircleView * dk_HomeCircleView;
@property (nonatomic, strong)DKHomeSourceView * dk_HomeSourceView;
@end
@implementation DKHomeAuthorizedCircleView
-(instancetype)init{
    if(self == [super init]){
        self.backgroundColor = UIColor.whiteColor;
        self.layer.cornerRadius = DK_IsWidthScale(20);
        [self dk_addSubView];
    }
    return self;
}
- (void)dk_addSubView{
    self.dk_HomeCircleView = [[DKHomeCircleView alloc] init];
    [self addSubview:self.dk_HomeCircleView];
    [self.dk_HomeCircleView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(DK_IsWidthScale(80)));
        make.right.equalTo(@(-DK_IsWidthScale(80)));
        make.top.equalTo(@(DK_IsWidthScale(20)));
        make.height.equalTo(@(DK_IsWidthScale(115)));
    }];
    self.dk_HomeSourceView = [[DKHomeSourceView alloc] init];
    [self addSubview:self.dk_HomeSourceView];
    [self.dk_HomeSourceView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(DK_IsWidthScale(0)));
        make.right.equalTo(@(-DK_IsWidthScale(0)));
        make.top.equalTo(self.dk_HomeCircleView.mas_bottom).offset(DK_IsWidthScale(10));
        make.height.equalTo(@(DK_IsWidthScale(36)));
    }];
}
- (void)updataHomeHeadData{
    DKUserComplaintModel *dk_UserComplaintMdl = [DKGlobalHelper defaultManager].userComplaintMdl;
    self.dk_HomeCircleView.limitRemain = dk_UserComplaintMdl.unused;
    self.dk_HomeCircleView.limitFrozen = dk_UserComplaintMdl.locking;
    self.dk_HomeCircleView.limitUserd = dk_UserComplaintMdl.used;
    self.dk_HomeCircleView.limitAvailable = dk_UserComplaintMdl.unused;
    self.dk_HomeCircleView.totalLimitValue = dk_UserComplaintMdl.total;
    [self.dk_HomeCircleView startUpdate];
    
    self.dk_HomeSourceView.limitRemain = dk_UserComplaintMdl.unused;
    self.dk_HomeSourceView.limitFrozen = dk_UserComplaintMdl.locking;
    self.dk_HomeSourceView.limitUserd = dk_UserComplaintMdl.used;
}
@end
